<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<html>
<head>
    <title>登录</title>
    <style>
        div {
            text-align: center;
            width: 300px;
            height: 180px;
            margin: 50px auto;
            border: 1px solid #000;
        }
    </style>
    <script src="js/jquery.min.js"></script>
</head>
<body>
<div>
    <h3>登录页面</h3>
    <form action="${base}/loginServlet" method="post">
        <p>
            <input type="text" name="sno" placeholder="请输入学号" id="sno">
        </p>
        <p>
            <input type="password" name="pwd" placeholder="请输入密码" id="pwd">
        </p>
        <p>
            <input type="submit" value="登录" id="loginForm">&nbsp
            <input type="reset" value="重置">
        </p>
    </form>
</div>
<script>
    $(function () {
        $("#loginForm").click(function () {
            let sno = $("#sno");
            let pwd = $("#pwd");
            if (sno.val() == "" || pwd.val() == "") {
                alert("学号和密码不能为空！请输入学号和密码");
                sno.val("");
                sno.val("");
                return false;
            }
        });
    });
</script>
</body>
</html>
